<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/init.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<jsp:include page="/WEB-INF/jsp/common/common.jsp" />
<jsp:include page="/WEB-INF/jsp_lib/layer.jsp" />
<jsp:include page="/WEB-INF/jsp_lib/validate.jsp" />
<script type="text/javascript">
	$(function() {
		$("select[name='seal_type_id']").val('${seal.seal_type_id}');
		$("#form1").validate({
			rules : {
				'bank_name' : {
					required : true
				},
				'seal_type_id' : {
					required : true
				},
				'seal_type_config_id' : {
					required : true
				},
				'title' : {
					required : true,
					maxlength:100
				},
				'desc_s' : {
					maxlength:100
				},
				'note' : {
					maxlength:255
				},
				'true_code':{
					digits:true,
					minlength:9,
					maxlength:9,
					remote:{
						type:"POST",
	               		url	:"${path}/ix/seal/news/apply/unique_code.htm?seal_new_id=${seal._id}"   
					}
				}
			},
			messages :{
				true_code:{remote :"该编码已存在，请重新输入！"}
			}
		});
		setTypeConfig();
	});
	function mysubmit(flag) {
		$("input[name='flag']").val(flag);
		$("#form1").submit();
	}
	//下拉 印章类型,弹出印章种类
	function setTypeConfig(){
		var seal_type_id = $("select[name='seal_type_id']").val();
		$.ajax({
			type:"post",
			cache:true,
			url:"${path}/ix/seal/type/configs_select.htm?seal_type_id="+seal_type_id,
			success:function(data){
				$("#seal_types").html(data);
				$("select[name='seal_type_config_id']").val('${seal.seal_type_config_id}');
			}
		
		});
	}
</script>
</head>
<body>
	<jsp:include page="/WEB-INF/jsp_lib/tip.jsp" />
	<jsp:include page="/WEB-INF/jsp/common/select_user_bank.jsp" />
		<div id="add_edit_form" style="margin-left: 10px;">
			<!-- 内容 -->
			<div>
				<form method="post" action="${path}/ix/seal/news/apply/edit.htm" id="form1">
					<input name="flag" type="hidden" value="${seal.flag }" />
					<input name="seal_id" type="hidden" value="${seal._id }" />
					<h2>
						<div>新章修改</div>
					</h2>
					<table width="100%" class="lindex">
						<tr >
							<input name="bank_id" type="hidden" value="${bank._id}" type="text" />
							<th align="right" >使用机构：</th>
							<td align="left"><input name="bank_name" readonly="readonly" onClick="getArea();" style="width:300px" 
								value="${bank.name }" type="text" maxlength="100" /> <a
								href="javascript:getArea()"><img alt="请选择使用机构"
									src="${path }/style_cp/img/02.gif" /></a></td>
							<th align="right">
								实物编号：
							</th>
							<td align="left" >
								<input name="true_code" value="${seal.true_code }" type="text" maxlength="32" />
							</td>
						</tr>
						<tr>
							<th align="right">印章种类：</th>
							<td align="left">
								<select name="seal_type_id" onchange="setTypeConfig('choose')">
									<option value="">--请选择--</option>
									<c:forEach items="${sealTypeList}" var="tp">
										<option value="${tp._id}">${tp.name}</option>
									</c:forEach>
								</select>
							</td>
							<th align="right">印章类型：</th>
							<td align="left" id="seal_types">
							
							</td>
						</tr>
						<tr>
							<th align="right">刻章字样：</th>
							<td align="left"><textarea name="title" rows="2" cols="50">${seal.title }</textarea></td>
							<th align="right">刻章原因：</th>
							<td align="left"><textarea name="desc_s" rows="2" cols="50">${seal.desc_s }</textarea></td>

						</tr>
						<tr>
							<th align="right">备注：</th>
							<td align="left" colspan="3"><textarea name="note" rows="5"
									cols="50">${seal.note }</textarea></td>
						</tr>
					</table>
					<div class="options">
						<a href="javascript:mysubmit('已保存');" class="asave"> 【保存】 </a>
						<a href="javascript:mysubmit('审核中');" class="asave"> 【提交】 </a>
						<a href="javascript:goBack();" class="asave"> 【返回】 </a>
					</div>
				</form>
			</div>
		</div>
</body>
</html>
